#include "player.h"

Player::Player(CL_Sprite* image, std::vector<CL_Sprite*>* animation) {
	this->lifes = 3;
	this->hitpoints = 3;
	this->hasHabanero = false;
	this->playerImage = image;
	this->score = 0;
	this->currentFrame = 0;
	this->playerAnimation = animation;
	this->playerState = PlayerDirection::NONE;
	this->habaneroTimer = HABANERO_TIMER_START;
	this->isDead = false;
	this->deathTimer =0;
}

Player::~Player(void) {
}

void Player::setPlayerGraphics_mirrored(CL_Sprite* image, std::vector<CL_Sprite*>* animation) {
	this->playerImage_mirrored = image;
	this->playerAnimation_mirrored = animation;
	this->lastPlayerDirection = PlayerDirection::RIGHT;
}
CL_Sprite* Player::getPlayerImage() {
	return playerImage;
}

CL_Sprite* Player::getPlayerAnimatedImage() {
	currentFrame+=1;
	return playerAnimation->at((currentFrame/4) % playerAnimation->size());
}

CL_Sprite* Player::getPlayerImage_mirrored() {
	return playerImage_mirrored;
}

CL_Sprite* Player::getPlayerAnimatedImage_mirrored() {
	currentFrame+=1;
	
	return playerAnimation_mirrored->at((currentFrame/4) % playerAnimation_mirrored->size());
}

int Player::getHitpoints() {
	return hitpoints;
}

int Player::getLifes() {
	return lifes;
}

void Player::setLifes(int x) {
	this->lifes = x;
}

int Player::getScore() {
	return score;
}

float Player::getPosX() {
	return posX;
}

float Player::getPosY() {
	return posY;
}

void Player::setPosX(float x) {
	this->posX = x;
}

void Player::setPosY(float y) {
	this->posY = y;
}

PlayerDirection::PlayerDirection Player::getPlayerState() {
	return this->playerState;
}

void Player::setPlayerState(PlayerDirection::PlayerDirection state) {
	this->playerState = state;
}
PlayerDirection::PlayerDirection Player::getLastPlayerDirection() {
	return this->lastPlayerDirection;
}

void Player::setLastPlayerDirection(PlayerDirection::PlayerDirection state) {
	this->lastPlayerDirection = state;
}

void Player::setScore(int x) {
	this->score = x;
}

bool Player::getHasHabanero(){
	return this->hasHabanero;
}
void Player::setHasHabanero(bool b){
	if(b==true){
	this->habaneroTimer = HABANERO_TIMER_START;
	}
	hasHabanero=b;
}

void Player::setHabaneroTimer(int i){
	habaneroTimer=i;	
}

int Player::getHabaneroTimer(){
	return this->habaneroTimer;
}

bool Player::getIsDead(){
	return this->isDead;
}
void Player::setIsDead(bool b){
	if(b==true){
		this->deathTimer = DEATH_TIMER_START;
	}
	isDead=b;
}

void Player::setDeathTimer(int i){
	deathTimer=i;	
}

int Player::getDeathTimer(){
	return this->deathTimer;
}



